<template>
  <view class="pageStyle">
	<!-- <g-watermark/> -->
    <web-view :src="urls"></web-view>
  </view>
</template>
<script>
import { Api } from "@/utils/Api.js";
import { mapState } from "vuex";
export default {
  data() {
    return {
      describe: "发起流程",
      url: {
        list: "/m/flow/flowDispose?skey=",
      },
	  flowType: 2,
	  flowTypeCode: '',
	  op: '', // 用于操作列按钮
	  btnId:'', // 用于操作列按钮
	  moduleId: -1, // 用于操作列按钮
	  moduleCode: '', // 用于操作列按钮
	  btnParams: {}, // 用于表单中的按钮
    };
  },
  onLoad(options) {
    let records = JSON.parse(options.record);
	console.log('records', records);
	if (records.flowType || records.op) {
		this.flowType = records.flowType;		
		this.flowTypeCode = records.code || records.flowTypeCode || records.typeCode;
		this.btnId = records.btnId;
		this.moduleId = records.moduleId || -1;
		this.moduleCode = records.moduleCode || '';
		this.op = records.op || '';
		this.btnParams = encodeURI(JSON.stringify({
			btnFieldName: records.btnFieldName,
			flowId: records.flowId,
			}));
	}

    // 动态获取webview链接
    // this.urls =
    //   Api.baseUrl +
    //   "/" +
    //   records.code +
    //   "?skey=" +
    //   this.loginInfo.skey +
    //   "&isUniWebview=true";
  },
  computed: {
    ...mapState(["loginInfo"]),
    urls() {
      let urls = Api.baseUrl + this.url.list + this.loginInfo.skey
	   + "&flowTypeCode=" + this.flowTypeCode + "&type=" + this.flowType + "&isUniWebview=true"
	   + "&op=" + this.op + "&btnParams=" + this.btnParams + "&moduleId=" + this.moduleId + "&btnId=" + this.btnId + "&moduleCode=" + this.moduleCode;
      console.log('urls', urls);
	  return urls;
    },
  },
};
</script>

<style lang="scss" scoped>
</style>
